LL DMA secure attributes settings APIs migration

This section provides information about the LL DMA secure attributes settings APIs migration.

LL DMA transfer secure attributes settings functions

HAL 1

HAL 2

Description

In HAL1, there are several functions to configure and check the security attribute of a DMA channel transfer (source and destination):

  • LL_DMA_ConfigChannelSecure() allows configuring both the channel transfer source and destination security attributes.

  • LL_DMA_EnableChannelSrcSecure(), LL_DMA_DisableChannelSrcSecure(), LL_DMA_IsEnabledChannelSrcSecure() allow respectively enabling, disabling, and checking the security attribute for the channel transfer source.

  • LL_DMA_EnableChannelDestSecure(), LL_DMA_DisableChannelDestSecure(), LL_DMA_IsEnabledChannelDestSecure() allow respectively enabling, disabling, and checking the security attribute for the channel transfer destination.

In HAL2, all these functions are replaced by:

  • LL_DMA_SetXferSecAttr(), which allows configuring the DMA channel transfer security attributes for the source and/or destination (either both together or individually).

  • LL_DMA_GetXferSecAttr(), which allows reading back the DMA channel transfer security attribute configuration for the source or destination.

Set secure channel source attribute

LL_DMA_EnableChannelSrcSecure(&hdma,
                              LL_DMA_CHANNEL_0);
/* or */
LL_DMA_ConfigChannelSecure(&hdma,
                           LL_DMA_CHANNEL_0,
                           LL_DMA_CHANNEL_SRC_SEC);
LL_DMA_SetXferSecAttr(&hdma,
                      LL_DMA_CHANNEL_0,
                      LL_DMA_SEC_ITEM_SRC,
                      LL_DMA_ATTR_SEC);

Set no secure channel source attribute

LL_DMA_DisableChannelSrcSecure(&hdma,
                               LL_DMA_CHANNEL_0);
/* or */
LL_DMA_ConfigChannelSecure(&hdma,
                           LL_DMA_CHANNEL_0,
                           LL_DMA_CHANNEL_SRC_NSEC);
LL_DMA_SetXferSecAttr(&hdma,
                      LL_DMA_CHANNEL_0,
                      LL_DMA_SEC_ITEM_SRC,
                      LL_DMA_ATTR_NSEC);

Get channel source attribute security

LL_DMA_IsEnabledChannelSrcSecure(&hdma,
                                 LL_DMA_CHANNEL_0);
LL_DMA_GetXferSecAttr(&hdma,
                      LL_DMA_CHANNEL_0,
                      LL_DMA_SEC_ITEM_SRC);

Set secure channel destination attribute

LL_DMA_EnableChannelDestSecure(&hdma,
                               LL_DMA_CHANNEL_0);
/* or */
LL_DMA_ConfigChannelSecure(&hdma,
                           LL_DMA_CHANNEL_0,
                           LL_DMA_CHANNEL_DEST_SEC);
LL_DMA_SetXferSecAttr(&hdma,
                      LL_DMA_CHANNEL_0,
                      LL_DMA_SEC_ITEM_DEST,
                      LL_DMA_ATTR_SEC);

Set no secure channel destination attribute

LL_DMA_DisableChannelDestSecure(&hdma,
                                LL_DMA_CHANNEL_0);
/* or */
LL_DMA_ConfigChannelSecure(&hdma,
                           LL_DMA_CHANNEL_0,
                           LL_DMA_CHANNEL_DEST_NSEC);
LL_DMA_SetXferSecAttr(&hdma,
                      LL_DMA_CHANNEL_0,
                      LL_DMA_SEC_ITEM_DEST,
                      LL_DMA_ATTR_NSEC);

Get channel destination attribute security

LL_DMA_IsEnabledChannelDestSecure(&hdma,
                                  LL_DMA_CHANNEL_0);
LL_DMA_GetXferSecAttr(&hdma,
                      LL_DMA_CHANNEL_0,
                      LL_DMA_SEC_ITEM_DEST);

LL DMA channel secure attributes settings functions

HAL 1

HAL 2

Description

In HAL1, there are several functions to configure and check the security attribute of a DMA channel:

  • LL_DMA_ConfigChannelSecure(), LL_DMA_EnableChannelSecure(), LL_DMA_DisableChannelSecure(), LL_DMA_IsEnabledChannelSecure() allow respectively setting, enabling, disabling, and checking the security attribute for the channel.

In HAL2, all these functions are replaced by:

  • LL_DMA_SetSecAttr(), which allows configuring the DMA channel security attribute.

  • LL_DMA_GetSecAttr(), which allows reading back the DMA channel security attribute configuration.

Set secure channel attribute

LL_DMA_EnableChannelSecure(&hdma,
                           LL_DMA_CHANNEL_0);
/* or */
LL_DMA_ConfigChannelSecure(&hdma,
                           LL_DMA_CHANNEL_0,
                           LL_DMA_CHANNEL_SEC);
LL_DMA_SetSecAttr(&hdma,
                  LL_DMA_CHANNEL_0,
                  LL_DMA_ATTR_SEC);

Set no secure channel attribute

LL_DMA_DisableChannelSecure(&hdma,
                            LL_DMA_CHANNEL_0);
/* or */
LL_DMA_ConfigChannelSecure(&hdma,
                           LL_DMA_CHANNEL_0,
                           LL_DMA_CHANNEL_NSEC);
LL_DMA_SetSecAttr(&hdma,
                  LL_DMA_CHANNEL_0,
                  LL_DMA_ATTR_NSEC);

Get channel attribute security

LL_DMA_IsEnabledChannelSecure(&hdma,
                              LL_DMA_CHANNEL_0);
LL_DMA_GetSecAttr(&hdma,
                  LL_DMA_CHANNEL_0);

LL DMA channel privilege attributes settings functions

HAL 1

HAL 2

Description

In HAL1, there are several functions to configure and check the privilege attribute of a DMA channel:

  • LL_DMA_EnableChannelPrivilege(), LL_DMA_DisableChannelPrivilege() and LL_DMA_IsEnabledChannelPrivilege() allow respectively enabling, disabling, and checking the privilege attribute for the channel.

In HAL2, all these functions are replaced by:

  • LL_DMA_SetPrivAttr(), which allows enable and disable the DMA channel privilege attribute.

  • LL_DMA_GetPrivAttr(), which allows reading back the DMA channel privilege attribute configuration.

Enable privilege channel attribute

LL_DMA_EnableChannelPrivilege(&hdma,
                              LL_DMA_CHANNEL_0);
LL_DMA_SetPrivAttr(&hdma,
                   LL_DMA_CHANNEL_0,
                   LL_DMA_ATTR_PRIV);

Disable privilege channel attribute

LL_DMA_DisableChannelPrivilege(&hdma,
                               LL_DMA_CHANNEL_0);
LL_DMA_SetPrivAttr(&hdma,
                  LL_DMA_CHANNEL_0,
                  LL_DMA_ATTR_NPRIV);

Get channel attribute privilege

LL_DMA_IsEnabledChannelPrivilege(&hdma,
                            LL_DMA_CHANNEL_0);
LL_DMA_GetPrivAttr(&hdma,
                  LL_DMA_CHANNEL_0);

LL DMA channel lock attributes settings functions

HAL 1

HAL 2

Enable lock channel attribute

LL_DMA_EnableChannelLockAttribute(&hdma,
                                  LL_DMA_CHANNEL_0);
LL_DMA_LockAttr(&hdma,
                LL_DMA_CHANNEL_0);

Get channel attribute lock

LL_DMA_IsEnabledChannelLockAttribute(&hdma,
                                     LL_DMA_CHANNEL_0);
LL_DMA_IsLockedAttr(&hdma,
                    LL_DMA_CHANNEL_0);